#! /bin/sh

# Quick-and-dirty script that takes a multimedia video file
# and converts it to a bunch of different output formats.

# Intended for generating test input to tovid, to determine
# which input video formats it can('t) handle.

# ffmpeg output video codecs
VCODECS="asv1 asv2 dvvideo flv h263p mpeg1video mpeg2video mpeg4 \
mpegvideo msmpeg4 msmpeg4v1 msmpeg4v2 pam rawvideo svq1 wmv1 wmv2"
ACODECS="adpcm_ima_wav adpcm_ms mp2 mp3 pcm_alaw pcm_mulaw \
pcm_s16le pcm_u8 sonic sonicls vorbis "

for VCODEC in $VCODECS; do
    CMD="ffmpeg -i $1 -vcodec $VCODEC -acodec ac3 $1.$VCODEC.ac3.avi"
    echo $CMD >> replicate.log
    if eval $CMD; then
        echo "Success!" >> replicate.log
    else
        echo "Failed!" >> replicate.log
    fi
done

for ACODEC in $ACODECS; do
    CMD="ffmpeg -i $1 -vcodec mpeg2video -acodec $ACODEC $1.mpeg2video.$ACODEC.avi"
    echo $CMD >> replicate.log
    if eval $CMD; then
        echo "Success!" >> replicate.log
    else
        echo "Failed!" >> replicate.log
    fi
done
